/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bsc.ejb.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

/**
 *
 * @author memozac
 */
@Entity
public class ScoreView implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long idScoreView;

    @OneToOne
    private ScoreDomain scoreDomain;

    @ManyToMany(targetEntity=Topic.class)
    @JoinTable(name="TopicScoreView",
    joinColumns=@JoinColumn(name="idScoreView"),
    inverseJoinColumns=@JoinColumn(name="idTopic"))
    private Collection<Topic> topics;
    
    @Column(columnDefinition="text")
    private String name;
    @Column(columnDefinition="text")
    private String description;

    @OneToOne
    private ScoreCard scoreCard;
    
    @OneToMany
    private Collection<SRM> SRMs;

    public ScoreDomain getScoreDomain() {
        return scoreDomain;
    }

    public void setScoreDomain(ScoreDomain scoreDomain) {
        this.scoreDomain = scoreDomain;
    }

    public Collection<Topic> getTopics() {
        return topics;
    }

    public void setTopics(Collection<Topic> topics) {
        this.topics = topics;
    }

    public Collection<SRM> getSRMs() {
        return SRMs;
    }

    public void setSRMs(Collection<SRM> SRMs) {
        this.SRMs = SRMs;
    }

    public void setTopics(List<Topic> topics) {
        this.topics = topics;
    }

    public Long getIdScoreView() {
        return idScoreView;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idScoreView != null ? idScoreView.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof ScoreView)) {
            return false;
        }
        ScoreView other = (ScoreView) object;
        if ((this.idScoreView == null && other.idScoreView != null) || (this.idScoreView != null && !this.idScoreView.equals(other.idScoreView))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bsc.ejb.entity.ScoreView[id=" + idScoreView + "]";
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @return the scoreCard
     */
    public ScoreCard getScoreCard() {
        return scoreCard;
    }

    /**
     * @param scoreCard the scoreCard to set
     */
    public void setScoreCard(ScoreCard scoreCard) {
        this.scoreCard = scoreCard;
    }

}//ends of class
